﻿
namespace OfficeClip.OpenSource.StyleFix.Drivers
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Text;

    public class DocumentationRules : StyleCopRules
    {
        public void SA1633_FileMustHaveHeader(string fileName, ref string outputLines)
        {
            if (IsAllowed("SA1633"))
            {
                return;
            }

            if (!ForceAllow && (Properties.Settings.Default.CompanyName == string.Empty))
            {
                return;
            }

            string copyrightMessage =
 @"//----------------------------------------------------------------------------------------------
// <copyright file=""{0}"" company=""{1}"">
// Copyright (c) {1}.  All rights reserved.
// </copyright>
//-------------------------------------------------------------------------------------------------
";
            copyrightMessage = string.Format(copyrightMessage, fileName, Properties.Settings.Default.CompanyName);

            // add the file header in the begining of the file
            if (outputLines.IndexOf("<copyright file=") == -1)
            {
                outputLines = outputLines.Insert(0, copyrightMessage);
            }
        }
    }
}
